package ms.jasim.console.gui.component;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Insets;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.border.EmptyBorder;

import com.jgoodies.forms.factories.FormFactory;
import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.RowSpec;

public class DialogHeaderPanel extends JPanel {

	private JLabel dialogTitleLabel;
	private JTextArea dialogSubtextTextArea;
	private static final long serialVersionUID = 1L;

	/**
	 * Create the panel
	 */
	public DialogHeaderPanel() {
		super();
		setLayout(new FormLayout(new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("480px") }, new RowSpec[] {
				FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, RowSpec.decode("26px") }));
		setBorder(new EmptyBorder(0, 0, 0, 0));
		setMaximumSize(new Dimension(0, 5));
		setBackground(new Color(255, 255, 255));

		dialogTitleLabel = new JLabel();
		dialogTitleLabel.setFont(new Font("Tahoma", Font.BOLD, 20));
		dialogTitleLabel.setBackground(Color.WHITE);
		dialogTitleLabel.setText("Dialog Title");
		add(dialogTitleLabel, new CellConstraints("2, 2, 1, 1, fill, fill"));

		dialogSubtextTextArea = new JTextArea();
		dialogSubtextTextArea.setFont(new Font("Tahoma", Font.PLAIN, 11));
		dialogSubtextTextArea.setWrapStyleWord(true);
		dialogSubtextTextArea.setOpaque(false);
		dialogSubtextTextArea.setFocusable(false);
		dialogSubtextTextArea.setEditable(false);
		dialogSubtextTextArea.setLineWrap(true);
		dialogSubtextTextArea.setMargin(new Insets(0, 20, 0, 0));
		dialogSubtextTextArea.setText("Dialog subtext");
		add(dialogSubtextTextArea, new CellConstraints("2, 3, 1, 1, fill, fill"));
		//
	}

	public void setTitle(String value) {
		dialogTitleLabel.setText(value);
	}
	
	public String getTitle(String value) {
		return dialogTitleLabel.getText();
	}
	
	public void setSubTitle(String value) {
		dialogSubtextTextArea.setText(value);
	}
	
	public String getSubTitle() {
		return dialogSubtextTextArea.getText();
	}
}
